package com.struts.deal.corpor.manage.system;

import java.sql.SQLException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ibatis.common.util.PaginatedList;
import com.ibatis.po.corpor.TCorporation;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.lg.system.CSqlMap;
import com.struts.web.user.manage.system.EditPassForm;

public class SysDeal {
     
	
	/**
	 * 用户修改密码
	 * @param request
	 * @param response
	 * @param aWebForm
	 * @return
	 * @throws SQLException
	 */
	public static boolean  modiPass(HttpServletRequest request,
            HttpServletResponse response,
            EditPassForm aWebForm) throws SQLException {
		boolean result = false;
		SqlMapClient sqlmap = CSqlMap.getSqlMapConfig();
		TCorporation corpor = (TCorporation)request.getSession().getAttribute("Corporation");
		try{
			if(corpor == null){ //判断用户是否超时或者非法登录
				result = false;
			}else{
				aWebForm.setId(corpor.getId());
				if(aWebForm.getOldPass()!= null && aWebForm.getOldPass().length()>0 && aWebForm.getNewPass() != null && aWebForm.getNewPass().length()>0){
				int temp = sqlmap.update("T_CORPORATION.updatePass",aWebForm);
					if(temp>0){
					result = true;
					}
				}
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return result;
	}
	
}
